import Vue from "vue";
import ComponentTemplate from "./form.vue";
const VueComponent = Vue.extend(ComponentTemplate);

export const dialogForm = (option: any) => {
    const vm: any = new VueComponent().$mount();
    vm.name = option.name || "";
    vm.id = option.id || "";
    vm.isOperation = option.isOperation || false;
    vm.$on("sure", (model: any) => {
        if (option && option.sure) option.sure(vm, model);
    });
    vm.$on("close", (model: any) => {
        if (option && option.close) option.close(vm, model);
    });
    vm.show = true;
    return vm;
};
